﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using System.Collections.Generic;
using COM.OA.BLL;

public partial class qs_rizhi_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            string w_id = this.Request.QueryString["w_id"];
            int wid = Int32.Parse(w_id);
            //根据ＩＤ查出信息
            worklog wl = worklogBLL.Select(wid);
            int u_id = wl.w_u_id;
            users us = usersBLL.Select(u_id);
            this.txtUname.Text = us.u_username;
            this.txtBiaoTi.Text = wl.w_title;
            this.ftbNeiRong.Text = wl.w_content;

        }
       
        
    }
    protected void btXiuGai_Click(object sender, EventArgs e)
    {
        DateTime aa = DateTime.Now;

        string uname =this.txtUname.Text;
        //取姓名ID
        string where1 = "u_username='{0}'";
        where1 = string.Format(where1, uname);
        IList<users> listuname = usersBLL.Select(where1);
        users user = listuname[0];
        int userId = user.u_id;


        string biaoti = this.txtBiaoTi.Text;
        string neirong = this.ftbNeiRong.Text;
     
          string id=this.Request.QueryString["w_id"]; 
            int workid=Int32.Parse(id);
         
           worklog wll = worklogBLL.Select(workid);

           

            wll.w_u_id = userId;
            wll.w_title = biaoti;
            wll.w_content = neirong;
            wll.w_sendtime = aa;
            wll.w_clicks = 0;
            wll.w_state = 0;
            wll.w_readcontent = "";
            wll.w_readerid = 0;
            wll.w_readtime = DateTime.Parse("2008-01-01");


            worklogBLL.Update(wll);
            this.Response.Write(string.Format(GetRedirect.WINALERT, "修改成功"));
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "rizhijilu.aspx"));
            
       
        
       
        
       
    }

  
}
